package mutipackage;


import org.apache.log4j.Logger;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;

public class MutiHandler extends IoHandlerAdapter {

	static Logger logger = Logger.getLogger(MutiHandler.class);

	@Override
	public void exceptionCaught(IoSession session, Throwable cause)
			throws Exception {
		cause.printStackTrace();
	}

	@Override
	public void messageReceived(IoSession session, Object message)
			throws Exception {
		String pack = (String) message;
		logger.debug("收到：" + pack);
		session.write("我收到了"+pack) ;
	}

	@Override
	public void sessionIdle(IoSession session, IdleStatus status)
			throws Exception {
		logger.debug("IDLE " + session.getIdleCount(status));
	}

}
